import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/404',                                                                           
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index'),
      meta: { title: 'Dashboard', icon: 'dashboard' }
    }]
  },

   // --- 李春雨大棚管理路由
   {
    path: '/greenhouse',
    component: Layout,
    redirect: '/greenhouse/list',
    name: 'Greenhouse',
    meta: { title: '大棚管理', icon: 'example' },
    children: [
      {
        path: 'list',
        name: 'GreenhouseList',
        component: () => import('@/views/Greenhouse/List'),
        meta: { title: '大棚列表' }
      }
    ]
  },

  // 李培安：基本角色、基本角色权限、基本权限
  {
    path: '/lpa',
    component: Layout,
    redirect: '/lpa/baserole',
    name: 'lpa',
    meta: { title: '李培安', icon: 'example' },
    children: [
      {
        path: 'baserole',
        name: 'BaseroleList',
        component: () => import('@/views/baserole/List'),
        meta: { title: '基本角色列表'}
      },
      {
        hidden:true,
        path: 'baserole_form',
        name: 'Baserole_Form',
        component: () => import('@/views/baserole/Form'),
        meta: { title: '基本角色表单'}
      },
      {
        path: 'roleprivilege',
        name: 'RoleprivilegeList',
        component: () => import('@/views/roleprivilege/List'),
        meta: { title: '基本角色权限'}
      },
      {
        hidden:true,
        path: 'roleprivilege_form',
        name: 'Roleprivilege_Form',
        component: () => import('@/views/roleprivilege/Form'),
        meta: { title: '基本角色权限表单'}
      },
      {
        path: 'baseprivilege',
        name: 'BaseprivilegeList',
        component: () => import('@/views/baseprivilege/List'),
        meta: { title: '基本权限列表'}
      },
      {
        hidden:true,
        path: 'baseprivilege_form',
        name: 'Baseprivilege_Form',
        component: () => import('@/views/baseprivilege/Form'),
        meta: { title: '基本权限表单'}
      },
      {
        path: 'cars_recoginition',
        name: 'carsRecoginition',//当前路由名称
        component: () => import('@/views/CarsRecoginition/index'),
        meta: { title: '车辆识别'}
      }
    ]
  },
 // 李宗财
 {
  path: '/lzc',
  component: Layout,
  redirect: '/lzc/category',
  name: 'lzc',
  meta: { title: '李宗财', icon: 'example' },
  children: [
    {
      path: 'category',
      name: 'CategoryList',
      component: () => import('@/views/category/List'),
      meta: { title: '资讯分类'}
    },
     {
       hidden:true, //有，不显示
       path: 'category_form',
       name: 'CategoryList_Form',
       component: () => import('@/views/category/Form'),
       meta: { title: '资讯表单'}
     },
      {
        path: 'comment',
        name: 'commentList',
        component: () => import('@/views/comment/List'),
        meta: { title: '评论管理'}
      },
      {
       hidden:true, //有，不显示
       path: 'comment_form',
       name: 'commentList_Form',
       component: () => import('@/views/comment/Form'),
       meta: { title: '评论表单'}
      },
      {
        path: 'dataset',
        name: 'datasetList',
        component: () => import('@/views/dataset/List'),
        meta: { title: '数据合集'}
      },
      {
       hidden:true, //有，不显示
       path: 'dataset_form',
       name: 'datasetList_Form',
       component: () => import('@/views/dataset/Form'),
       meta: { title: '数据操作'}
      },
            {
        path: 'DishRecoginition',
        name: 'DishRecoginition',
        component: () => import('@/views/DishRecoginition/List'),
        meta: { title: '菜品识别'}
      },
  ] 
},

    //zhou
    {
    path: '/zhou',
    component: Layout,
    redirect: '/zhou/baseConfigList',
    name: 'zhou',
    meta: { title: '周天冯', icon: 'deploy' },
    children: [
      {
        path: 'baseConfigList',
        name: 'BaseConfigList',
        component: () => import('@/views/BaseConfig/List'),
        meta: { title: '基本配置列表', icon: 'deploy' }
      },
      {
        hidden:true, //有，不显示
        path: 'baseConfigFrom',
        name: 'BaseConfigFrom',
        component: () => import('@/views/BaseConfig/Form'),
        meta: { title: '基本配置表单', icon: 'deploy' }
      },
      {
        path: 'baseFileList',
        name: 'BaseFileList',
        component: () => import('@/views/BaseFile/List'),
        meta: { title: '基本文件', icon: 'document' }
      },
      {
        hidden:true, //有，不显示
        path: 'baseFileForm',
        name: 'BaseFileForm',
        component: () => import('@/views/BaseFile/Form'),
        meta: { title: '基本文件表单', icon: 'document' }
      },
      {
        path: 'baseLogList',
        name: 'BaseLogList',
        component: () => import('@/views/BaseLog/List'),
        meta: { title: '日志记录', icon: 'Log' }
      },
      {
        hidden:true, //有，不显示
        path: 'baseLogForm',
        name: 'BaseLogForm',
        component: () => import('@/views/BaseLog/Form'),
        meta: { title: '日志表单', icon: 'Log' }
      },
      {
        path: 'index',
        name: 'index',
        component: () => import('@/views/ingredientRecognition/index'),
        meta: { title: '果蔬识别', icon: 'ingredient' }
      }
    ]
    },
  //唐庭华
  {
    path: '/message',
    component: Layout,
    redirect: '/message/table',
    name: 'Message',
    meta: { title: '唐庭华', icon: 'example' },
    children: [
      {
        path: 'list',
        name: 'MessageList',
        component: () => import('@/views/Message/List'),
        meta: { title: '信息列表' ,icon:'table'}
      },
      {
        hidden:true,
        path: 'list_form',
        name: 'MessageList_Form',
        component: () => import('@/views/Message/Form'),
        meta: { title: '信息表单',icon:'table' }
      },
      {
        path: 'module',
        name: 'ModuleList',
        component: () => import('@/views/Module/List'),
        meta: { title: '模型管理列表' ,icon:'table'}
      },
      {
        hidden:true,
        path: 'module_form',
        name: 'ModuleList_form',
        component: () => import('@/views/Module/Form'),
        meta: { title: '模型管理表单' ,icon:'table'}
      },
      {
        path: 'call',
        name: 'CallList',
        component: () => import('@/views/Call/List'),
        meta: { title: '图像识别历史列表' ,icon:'table'}
      },
      {
        hidden:true,
        path: 'call_form',
        name: 'CallList_form',
        component: () => import('@/views/Call/Form'),
        meta: { title: '图像识别历史' ,icon:'table'}
      },
      {
        path: 'tth_recognition',
        name: 'Tth_recognition',
        component: () => import('@/views/Recognition/TthRecognition'),
        meta: { title: '动物识别' ,icon:'table'}
      },
      {
        hidden:true,
        path: 'tth_recognition_form',
        name: 'Tth_recognition_form',
        component: () => import('@/views/Recognition/TthRecognitionHistory'),
        meta: { title: '图像识别历史查看' ,icon:'table'}
      }

    ]
  },

    //黄有桢
    {
      path: '/hyz',
      component: Layout,
      redirect: '/hyz/baserUser',
      name: 'hyz',
      meta: { title: '黄有桢', icon: 'example' },
      children: [
        {
          path: 'baserUser',
          name: 'BaserUserList',
          component: () => import('@/views/hyz/baseUser/List'),
          meta: { title: '用户列表', icon:"table"}
        },
        {
          hidden:true,  // 有，但是不在菜单中显示
          path: 'baserUserform',
          name: 'BaserUserForm',
          component: () => import('@/views/hyz/baseUser/Form'),
          meta: { title: '用户表单', icon:"table"}
        },
        {
          path: 'userrole',
          name: 'UserroleList',
          component: () => import('@/views/hyz/userrole/List'),
          meta: { title: '权限列表', icon:"table"}
        },
        {
          hidden:true, 
          path: 'userroleform',
          name: 'UserroleForm',
          component: () => import('@/views/hyz/userrole/Form'),
          meta: { title: '权限表单', icon:"table"}
        },
        {
          path: 'article',
          name: 'Articlelist',
          component: () => import('@/views/hyz/Article/List'),
          meta: { title: '文章管理' ,icon:"table"}
        },
        {
          hidden:true,  // 有，但是不在菜单中显示
          path: 'articleform',
          name: 'ArticleoFrm',
          component: () => import('@/views/hyz/Article/Form'),
          meta: { title: '文章表单', icon:"table"}
        },
        {
          // hidden:true,  // 有，但是不在菜单中显示
          path: 'currencyDiscern',
          name: 'currencyDiscern',
          component: () => import('@/views/hyz/currency/index'),
          meta: { title: '货币识别', icon:"table"}
        },
      ]
    },
<<<<<<< HEAD
      //hyy
      {
        path: '/hyy',
        component: Layout,
        redirect: '/hyy/lists',
        name: 'hyy',
        meta: { title: '黄奕源', icon: 'example' },
        children: [
            {
                path: 'application',
                name: 'Application',
                component: () => import('@/views/Application/List'),
                meta: { title: '应用列表', icon:"table"}
              },
              {
                hidden:true,
                path: 'application_form',
                name: 'ApplicationForm',
                component: () => import('@/views/Application/Form'),
                meta: { title: '应用表单', icon:"table"}
              },
              {
                path: 'datasetFile',
                name: 'DatasetFile',
                component: () => import('@/views/DatasetFile/List'),
                meta: { title: '数据集列表', icon:"table"}
              },
              {
                hidden:true,
                path: 'datasetFile_form',
                name: 'DatasetFileForm',
                component: () => import('@/views/DatasetFile/Form'),
                meta: { title: '数据集表单', icon:"table"}
              },
                {
                    path: 'interfaces',
                    name: 'Interfaces',
                    component: () => import('@/views/Interfaces/List'),
                    meta: { title: '接口列表', icon:"table"}
                  },
                  {
                    hidden:true,
                    path: 'interfaces_form',
                    name: 'InterfacesForm',
                    component: () => import('@/views/Interfaces/Form'),
                    meta: { title: '接口表单', icon:"table"}
                  },    
                  {
                    path: 'redwine_recoginition',
                    name: 'redWineRecoginition',//当前路由名称
                    component: () => import('@/views/RedWineRecog/index'),
                    meta: { title: 'LOGO识别'}
                  }
        ]
      },
=======
        //hyy
        {
          path: '/hyy',
          component: Layout,
          redirect: '/hyy/lists',
          name: 'hyy',
          meta: { title: '黄奕源', icon: 'example' },
          children: [
              {
                  path: 'application',
                  name: 'Application',
                  component: () => import('@/views/Application/List'),
                  meta: { title: '应用列表', icon:"table"}
                },
                {
                  hidden:true,
                  path: 'application_form',
                  name: 'ApplicationForm',
                  component: () => import('@/views/Application/Form'),
                  meta: { title: '应用表单', icon:"table"}
                },
                {
                  path: 'datasetFile',
                  name: 'DatasetFile',
                  component: () => import('@/views/DatasetFile/List'),
                  meta: { title: '数据集列表', icon:"table"}
                },
                {
                  hidden:true,
                  path: 'datasetFile_form',
                  name: 'DatasetFileForm',
                  component: () => import('@/views/DatasetFile/Form'),
                  meta: { title: '数据集表单', icon:"table"}
                },
                  {
                      path: 'interfaces',
                      name: 'Interfaces',
                      component: () => import('@/views/Interfaces/List'),
                      meta: { title: '接口列表', icon:"table"}
                    },
                    {
                      hidden:true,
                      path: 'interfaces_form',
                      name: 'InterfacesForm',
                      component: () => import('@/views/Interfaces/Form'),
                      meta: { title: '接口表单', icon:"table"}
                    },    
                    {
                      path: 'redwine_recoginition',
                      name: 'redWineRecoginition',//当前路由名称
                      component: () => import('@/views/RedWineRecog/index'),
                      meta: { title: 'LOGO识别', icon:"logodete"}
                    }
          ]
        },
>>>>>>> c1a61930b92a369db39b402c285d11ea5f5aa63f
  
  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
